1. Field of the Invention
The present invention generally relates to virtual machines. More specifically, the present invention relates to techniques that facilitate providing precise exception semantics for a virtual machine.
2. Related Art
Virtual machines can be used to emulate different hardware environments upon the physical hardware of a computing device. For instance, a virtual machine can facilitate executing programs that have been compiled for a different instruction set architecture (ISA) than that of the computing device. Moreover, two or more virtual machines that emulate different hardware environments and/or operating systems may co-exist and simultaneously execute guest programs on the same computing device.
A virtual machine that emulates an ISA needs to precisely emulate the system semantics of the ISA. More specifically, the virtual machine needs to ensure that each exception which is signaled for a guest program is delivered at the precise program counter and with precisely the same state as would occur on the original target hardware for the ISA. However, because the virtual machine is executing on a computing device that uses different instructions and has different system semantics than the emulated ISA, ensuring precise exceptions can be challenging. Software techniques for providing precise exception semantics are very slow and consequently have a negative impact on program performance. Alternatively, hardware techniques that provide such precise exception semantics typically improve performance over software techniques, but involve additional hardware complexity and cost.
Hence, what is needed are structures and methods that provide precise exception semantics for a virtual machine without the above-described problems.